package com.example.myblog.mapper;

import com.example.myblog.model.ArticleInfo;
import com.example.myblog.model.UserInfo;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * Date:2022-10-28
 * Time:23:00
 * @Author: 东莞呵呵
 */
@Mapper
public interface UserMapper {

    /***
     * 注册用户
     * @param userInfo
     * @return
     */
    int reg(UserInfo userInfo);

    /***
     * 登录
     * @param userInfo
     * @return
     */
    UserInfo login(UserInfo userInfo);

    /***
     *
     * @param
     * @return
     */
    List<ArticleInfo> index(Integer offsetSize,Integer pageSize);

    /***
     * 根据aid获取文章
     * @param articleInfo
     * @return
     */
    ArticleInfo getArtByAid(ArticleInfo articleInfo);

    /***
     * 根据aid获取用户信息
     * @param articleInfo
     * @return
     */
    UserInfo getUserByAid(ArticleInfo articleInfo);

    /***
     * 访问次数加1
     * @param articleInfo
     * @return
     */
    int readCountIncrease(ArticleInfo articleInfo);

    /***
     * 根据uid获取全部博客
     * @param userInfo
     * @return
     */
    List<ArticleInfo> getAllArtByUid(UserInfo userInfo);

    /***
     * 根据Aid删除文章
     * @param articleInfo
     * @return
     */
    int delArtByAid(ArticleInfo articleInfo);

    /***
     * 添加文章
     * @param articleInfo
     * @return
     */
    int addArt(ArticleInfo articleInfo);
}
